import { postRequest, getRequest } from "@/utils/request";
import { postRequest1, getRequest1 } from "@/utils/request1";

// 登录接口
export const Login = (data) => {
  return postRequest1("/api/v2/cms/account/password_login", data);
};

// 获取图片验证码
export const GetCaptcha = () => {
  return getRequest1("/api/v2/cms/account/captcha");
};

// 获取验证码
export const emailSendApi = (data) => {
  return getRequest("/api/tool/email_send", data);
};

// 修改密码
export const ChangePassword = (data) => {
  return postRequest1("/api/v2/cms/account/change_password", data);
};
// 忘记密码
export const resetPasswordApi = (data) => {
  return postRequest("/api/user/resetPassword", data);
};

/**
 * 设置/修改交易密码
 * @param {} data.password        密码
 * @param {} data.confirm_password        确认密码
 * @param {} data.current_password        当前密码 （修改时必传）
 * @param {} data.code        验证码（邮箱）
 * @param {} data.opt        类型：set（设置），modify（修改）
 * @returns
 */
export const setPayPasswordApi = (data) => {
  return postRequest("/api/user/tradePassword", data);
};

// =============================== 加密接口 =======================

// 登录接口
export const newLogin = (data) => {
  return postRequest1("/api/v2/user/login", data);
};

// 忘记密码
export const resetNewPasswordApi = (data) => {
  return postRequest1("/api/v2/user/forget_password", data);
};

// 修改密码
export const ChangeNewPassword = (data) => {
  return postRequest1("/api/v2/user/change_password", data);
};

export const setPayPasswordNewApi = (data) => {
  return postRequest1("/api/v2/user/trade_password", data);
};

export const registerApi = (data) => {
  return postRequest1("/api/v2/user/register", data);
};

export const getCountryArea = () => {
  return getRequest1("/api/v2/user/country");
};
